function [newpath] = update_paths_general(basepath, file)
% update_paths_general  -  update the paths for files, starting in the basepath and
% searching through all the subdirectories for appropriate matches.
%

newpath = [];
basepath = append_backslash(basepath);
% first, just try a simple update path
newpath = update_paths(basepath, file);

if(~isempty(newpath))
   %   fprintf(2, 'found %s in %s\n', file, newpath);
   return; % it was found... go no further
end;

x=dir([basepath '*']);
j = find([x.isdir] == 1);
x=x(j); % reduce to just the directories

for i = 1: length(x)
   testpath = [basepath x(i).name];
   newpath = update_paths(testpath, file);
   if(~isempty(newpath))
     % fprintf(2, 'found %s in %s\n', file, newpath);
      return; % it was found... go no further
   end;
end;
fprintf(2, 'Did not find %s\n', file);
return;
